﻿@model ThaireInvestmentWeb.Models.AmortizeLoanScheduleModel
@{
    ViewBag.Title = "AmortizeLoanSchedule";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script>
    $(document).ready(function () {


        $("#CancelBtn").click(function (event) {

            showConfirm(null, CancelBtnAction);
            return false;
        });




    });


    function CancelBtnAction(event) {

        window.location.href = 'LoanInterest?headerID=@Model.HeaderID';
        }


</script>
@Html.Partial("_LoanHeaderView", Model.ScrData.LoanHeaderDTO)
      

@*<table class="tableform" width="100%" cellspacing="2">
    <tr>
        <td width="220">
            <div align="right">&nbsp; &nbsp; &nbsp;    Period: </div>
        </td>
        <td>&nbsp;</td>
        <td style="width: 240px">@Html.TextBoxFor(model => model.Period, new { @readonly = "readonly", style = "width: 110px;" })&nbsp;&nbsp;&nbsp;YEAR</td>

        <td width="188" align="right">
            <div align="right">&nbsp; </div>
        </td>
        <td>&nbsp;</td>
        <td width="208">&nbsp; 
        </td>
    </tr> 
</table>*@

<table width="95%" border="0" align="center">
    <tr>
        <td style="width: 733px">
            <div align="left">
                &nbsp;
            </div>
        </td>
        <td>
            <div align="right" style="text-align: right">

                <input type="button" name="CancelBtn" value="Interest" class="button" id="CancelBtn">
            </div>
        </td>
    </tr>
</table>
<table class="tablelist" width="100%" border="0" align="center" cellspacing="1" bgcolor="#333333">
    <!--DWLayoutTable-->
    <tr bgcolor="#CCCCCC">
        <th width="25" scope="col" style="text-align: center; height: 45px">Period</th>
        <th scope="col" style="text-align: center; width: 27px; height: 45px">Date</th>
        <th width="65" scope="col" style="text-align: center; height: 45px">No. of days</th>
        <th width="60" scope="col" style="text-align: center; height: 45px">Interest Rate</th>
        <th width="60" scope="col" style="text-align: center; height: 45px">Begining Balance</th>
        <th width="60" scope="col" style="text-align: center; height: 45px">Ending Balance</th>
        <th width="60" scope="col" style="text-align: center; height: 45px">Principal</th>
        <th width="60" scope="col" style="text-align: center; height: 45px">Interest</th>
        <th width="66" scope="col" style="text-align: center; height: 45px">Install./HM.</th>
    </tr>
    @if (Model.ScrData.LoansAmortizeDetail != null && Model.ScrData.LoansAmortizeDetail.Length > 0)
    {
        foreach (var item in Model.ScrData.LoansAmortizeDetail)
        {
        <tr bgcolor="#FFFFFF">
            <td height="31">
                <div align="center">@item.Period.GetValueOrDefault().ToString()</div>
                <td style="width: 27px; text-align: center;">@ThaireInvestmentWeb.Util.WebUtil.FormatDate(item.Date)</td>
            <td style="text-align: center">@item.NOOFDays.GetValueOrDefault().ToString()</td>
            <td style="text-align: center">@item.InterestRate.GetValueOrDefault().ToString()%</td>
            <td style="text-align: center">@ThaireInvestmentWeb.Util.WebUtil.FormatDecimal2Digit(item.BeginningBalance.GetValueOrDefault())</td>
            <td style="text-align: center">@ThaireInvestmentWeb.Util.WebUtil.FormatDecimal2Digit(item.EndingBalance.GetValueOrDefault())</td>
            <td style="text-align: center">@ThaireInvestmentWeb.Util.WebUtil.FormatDecimal2Digit(item.Principal.GetValueOrDefault())</td>
            <td style="text-align: center">@ThaireInvestmentWeb.Util.WebUtil.FormatDecimal2Digit(item.Interest.GetValueOrDefault())</td>
            <td style="text-align: center">@ThaireInvestmentWeb.Util.WebUtil.FormatDecimal2Digit(item.Installment.GetValueOrDefault())</td>
        </tr>  
        }

    }
</table>
